/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package ControllerBeans;

import Classes.DatabaseService;
import ModelBeans.UsersModelBean;
import Users.User;
import java.io.Serializable;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.ManagedProperty;
import javax.faces.bean.RequestScoped;
import org.primefaces.event.RowEditEvent;

/**
 *
 * @author xiph
 */
@ManagedBean
@RequestScoped
public class UsersControllerBean implements Serializable
{
	@ManagedProperty(value="#{usersModelBean}")
	private UsersModelBean umb;

	public UsersModelBean getUmb() {
		return umb;
	}

	public void setUmb(UsersModelBean umb) {
		this.umb = umb;
	}

	public UsersControllerBean() {
	}
	
	public void updateUser(RowEditEvent evt)
	{
		User u = (User) evt.getObject();
		DatabaseService.updateUser(u);
	}
	
	public void deleteUser(RowEditEvent evt)
	{
		User u = (User) evt.getObject();
		DatabaseService.deleteUser(u);
	}
}
